#include <iostream>

//logger
/*
#include <log4cplus/logger.h>
#include <log4cplus/configurator.h>
*/
#include <ScriptLoader/ScriptLoader.h>

#include <VisualizationModule/VisualizationModule.h>

using namespace std;
using namespace OpenNano;
using namespace log4cplus;


int main()
{
    BasicConfigurator config;
    config.configure();

    Logger logger = Logger::getInstance("main");

    logger.setLogLevel(TRACE_LOG_LEVEL);

    LOG4CPLUS_WARN(logger, "Hello, World!");

    OpenNano::ScriptLoader * loader = new OpenNano::ScriptLoader();
    VisualizationModule * vis = new VisualizationModule();

    string filename = "../test-config.xml";

    if ( loader->loadConfigFile(filename) )
    {
        LOG4CPLUS_INFO(logger, "Loading operation SUCCEDED!");
        VisualizationElement * _vis = (VisualizationElement *)loader->getConfigurations().find("visualization")->second;
        if (_vis)
        {
            LOG4CPLUS_INFO(logger, "Visualization element retrieved!");
            LOG4CPLUS_INFO(logger, "api:");
            LOG4CPLUS_INFO(logger, _vis->getVisualizationAPI());
            LOG4CPLUS_INFO(logger, "scene:");
            LOG4CPLUS_INFO(logger, _vis->getSceneFilename());
   /*         if (vis->init())
            {
                LOG4CPLUS_INFO(logger, "Visualization Module has inited");
            }
            else
            {
                LOG4CPLUS_INFO(logger, "Visualization Module has NOT inited");
            }*/
        }
        else
        {
            LOG4CPLUS_ERROR(logger, "Visualization element not retrieved!");
        }
    }
    else
    {
        LOG4CPLUS_ERROR(logger, "Loading operation FAILED!");
    }

    cout << "Hello world!" << endl;
    return 0;
}
